﻿using System;
using System.Collections.Generic;
using System.Linq;
using System.Linq.Expressions;
using System.Text;
using System.Threading.Tasks;

namespace Moon.Sql
{
    internal class NewArrayExpressionProvider
    {
        private ExpressionProvide _expression = null;

        public NewArrayExpressionProvider(ExpressionProvide expression)
        {
            _expression = expression;
        }

        public string Resolve(Expression exp)
        {
            NewArrayExpression ae = exp as NewArrayExpression;
            StringBuilder sb = new StringBuilder();
            foreach (Expression ex in ae.Expressions)
            {
                sb.Append(_expression.Resolve(ex)).Append(",");
            }
            return sb.ToString(0, sb.Length - 1);
        }
    }
}
